﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;

namespace PortalWeb.CMS.Web
{
    public class MvcApplication : System.Web.HttpApplication
    {
        protected void Application_Start()
        {
            SetDataDirectory();
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
        }

        private static void SetDataDirectory()
        {
            string dataDir = AppDomain.CurrentDomain.BaseDirectory;
            dataDir = System.IO.Directory.GetParent(dataDir).Parent.Parent.Parent.FullName;
            AppDomain.CurrentDomain.SetData("DataDirectory", dataDir+ @"\PortalWeb\PortalWeb\App_Data\");
        }
    }
}
